<?php

namespace app\common\Model;

use think\Model;

class Wallet extends Model {
	function getlist($map, $row = 20) {
		$pre = config ( 'database.prefix' );
		return db ( 'wallet w' )->leftJoin ( "{$pre}member m", "m.user_id=w.user_id" )->where ( $map )->order ( 'w.id desc' )->field ( 'w.*,m.user_name' )->paginate ( $row );
		// $page = $list->render ();
		// return array ('list' => $list->items (),'page' => $page );
	}
	function getAll($map) {
		return db ( 'wallet' )->where ( $map )->select ();
	}
	function getInfo($map = '') {
		$pre = config ( 'database.prefix' );
		return db ( 'wallet' )->where ( $map )->find ();
	}
	function add($data) {
		return db ( 'wallet' )->insertGetId ( $data );
	}
	function edit($map, $data) {
		return db ( 'wallet' )->where ( $map )->update ( $data );
	}
	function del($map) {
		return db ( 'wallet' )->where ( $map )->delete ();
	}
}

?>